package com.xh.web.controller;

import api.xh.domain.User;
import com.xh.api.IUserService;
import com.xh.web.service.ITestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Name UserController
 * @Description
 * @Author wen
 * @Date 2019-11-08
 */
@RestController
@RequestMapping("web/user")
public class UserController {

    @Autowired
    private IUserService userService;
    @Autowired
    private ITestService testService;

    @RequestMapping(value = "test/{id}", method = RequestMethod.GET)
    public User list(@PathVariable Long id) {
        return userService.findById(id);
    }

    @RequestMapping(value = "w/{id}/2", method = RequestMethod.GET)
    public User list2(@PathVariable Long id) {
        return userService.findById(id);
    }

    @RequestMapping(value = "list", method = RequestMethod.GET)
    public List<User> user() {
        return userService.findAll();
    }

    @RequestMapping(value = "test", method = RequestMethod.GET)
    public String test() {
        testService.test();
        return "test";
    }

}
